#include <allegro.h>
#include <stdio.h>

#define GFX_W 800
#define GFX_H 600
#define NB_IMAGES 5

struct cercle
{
int x1,y1;
};
typedef struct cercle cercle ;
struct cle 
{
	BITMAP * image;
	
	int cx, cy;
	
};
typedef struct cle cle;
struct piece
{
	BITMAP * imagep;
	
	int px, py;
	
};
typedef struct piece piece;
struct piece1
{
	BITMAP * image1p;
	
	int p1x, p1y;
	
};
typedef struct piece1 piece1;
struct piece2
{
	BITMAP * image2p;
	
	int p2x, p2y;
	
};
typedef struct piece2 piece2;
struct piece3
{
	BITMAP * image3p;
	
	int p3x, p3y;
	
};
typedef struct piece3 piece3;
struct piece4
{
	BITMAP * image4p;
	
	int p4x, p4y;
	
};
typedef struct piece4 piece4;
struct piece5
{
	BITMAP * image5p;
	
	int p5x, p5y;
	
};
typedef struct piece5 piece5;
struct piece6
{
	BITMAP * image6p;
	
	int p6x, p6y;
	
};
typedef struct piece6 piece6;
struct piece7
{
	BITMAP * image7p;
	
	int p7x, p7y;
	
};
typedef struct piece7 piece7;
struct piece8
{
	BITMAP * image8p;
	
	int p8x, p8y;
	
};
typedef struct piece8 piece8;
struct piece9
{
	BITMAP * image9p;
	
	int p9x, p9y;
	
};
typedef struct piece9 piece9;
struct piece10
{
	BITMAP * image10p;
	
	int p10x, p10y;
	
};
typedef struct piece10 piece10;
struct piece11
{
	BITMAP * image11p;
	
	int p11x, p11y;
	
};
typedef struct piece11 piece11;
struct coeur
{
	BITMAP * imagec;
	
	int cx, cy;
	
};
typedef struct coeur coeur;

struct evel 
{
	BITMAP * image1;
	int e_direction;
	int ex, ey;
	
};
typedef struct evel evel;
struct evel1 
{
	BITMAP * image2;
	int e1_direction;
	int e1x, e1y;
	
};
typedef struct evel1 evel1;


struct gentel 
{
	BITMAP * img_right[NB_IMAGES];
	BITMAP * img_left[NB_IMAGES];
	int x, y;
	int direction; // 0:right 1:left 2:up
};
typedef struct gentel gentel;

struct boull{
	BITMAP* imageb;
	int bx, by;
	int direction;
	
};
typedef struct boull boull;



//utils
int get_pixel(BITMAP* Buffer,int x,int y);


//Module Background
BITMAP* load_background_bmp(char chemin_background[]);
void draw_background(BITMAP *Background,BITMAP*Buffer);
//void destroy_background(BITMAP * Background);
void clignote (cle *cle, BITMAP *Background, gentel *gentel);
//Module Mario
void load_gentel(gentel *gentel);
void destroy_gentel(gentel *gentel);
void init_gentel(gentel *gentel,cercle *cercle,BITMAP *Buffer);

void move_gentel_right(gentel *gentel,cercle *cercle,int *compteur,BITMAP * Background,BITMAP*Buffer);
void move_gentel_left(gentel *gentel,cercle *cercle,int *compteur,BITMAP * Background,BITMAP*Buffer);
void jump_gentel(gentel *gentel,BITMAP * Background); //move up
//void gravity_gentel(gentel *gentel,BITMAP * Background);
void move_gentel(gentel *gentel,cercle *cercle,int *compteur,BITMAP * Background,BITMAP*Buffer);
void draw_gentel(gentel gentel,BITMAP *Buffer, int compteur);
void tir_gentel(BITMAP* Buffer, gentel* gentel,boull* boull, int* tir_status);
void collision(gentel *gentel,piece *piece);
void collision1(gentel *gentel,piece1 *piece1);
void collision2(gentel *gentel,piece2 *piece2);
void collision3(gentel *gentel,piece3 *piece3);
void collision4(gentel *gentel,piece4 *piece4);
void collision5(gentel *gentel,piece5 *piece5);
void collision6(gentel *gentel,piece6 *piece6);
void collision7(gentel *gentel,piece7 *piece7);
void collision8(gentel *gentel,piece8 *piece8);
void collision9(gentel *gentel,piece9 *piece9);
void collision10(gentel *gentel,piece10 *piece10);
void collision11(gentel *gentel,piece11 *piece11);
void collision12(gentel *gentel,coeur *coeur);
void collision13(gentel *gentel,cle *cle);
BITMAP *meilleur_score=load_bitmap(char chemin, NULL);
//void tir_gentel(gentel gentel,cercle *c,BITMAP *Background);
